package com.example.handle.common;

import com.example.exception.common.CustomerException;
import com.example.pojo.vo.common.Result;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/9/21 15:40
 */
@RestControllerAdvice(basePackages = {"com.example.controller"})
@Slf4j
public class GlobalExceptionJsonHandler {

    /**
     * Json 形式返回
     * @param e
     * @return
     */

    @ExceptionHandler(CustomerException.class)
    public Result<?> handleRRException(CustomerException e){
        return Result.error(e.getMessage());
    }
}
